class Particle {
  PVector position;  
  PVector velocity;  
  float radius;
  
  Particle() {
    //set the random number of x to the width of the canvas
    float x = random(width);
    //set the random number of y to the height of the canvas
    float y = random(height);
    //Initialize the position vector
    position = new PVector(x,y);
    //The initial velocity is 1, the random vector of the direction
    velocity = PVector.random2D();
    //Set the random number between 0 and 3, and the direction is the same
    velocity.setMag(random(3));
    //The radius is initialized to a random number between 1 and 5
    radius = random(1,5);
  }
  
  void update(){
    position.add(velocity); //The position vector plus the velocity vector
    boundary();
  }
  
  void boundary(){
    if(position.x < 0){
      position.x = width;
    }else if(position.x > width){
      position.x = 0;
    }
    
    if(position.y < 0){
      position.y = height;
    }else if(position.y > height){
      position.y = 0;
    }
  }
  
  void display(){
    noStroke();//Cancel the stroke
    fill(0); //Set the fill color to white
    ellipseMode(RADIUS);//Set the elliptical drawing mode to radius mode
    //drawing coordinate for position and radius for radius to Round shape
    ellipse(position.x,position.y,radius,radius);
  }
}

Particle[] particles; //Declare an array of object objects

void setup() {
  size(400,400);
  particles = new Particle[10];
  for (int i=0; i < particles.length; i++){
    particles[i] = new Particle();
  }
}

void draw(){
  background(204);
  for (int i = 0; i < particles.length; i++){
    particles[i].update();
    particles[i].display();
  }
}